-- hp_to_attack
-- created by panyl
-- 生命低于一定百分比时提升攻击

return {
    -- 返回的是提升的攻击点数
    apply = function(prop, baseValue)
        return prop[3];
    end,
    
    trigger = function(who, prop, attack)
        local rate = math.modf(1000 * who:queryAttrib("hp") / who:queryAttrib("max_hp"));
        local valve = tonumber(prop[2])
        
        if (rate < valve) then
            return math.modf(attack * prop[3] / 1000);
        end

        return 0;
    end,

    record = function(target, prop, path)
        return false;
    end 
};